<%@page language="java" pageEncoding="UTF-8" contentType="text/html; UTF-8" isELIgnored="false" %>
<%@ include file="../common.jsp"%>
<html>
<head>
    <link rel="stylesheet" href="${ctx}/statics/layui/css/layui.css">
    <style>
        *{
            padding: 0;
            margin: 0;
        }
        h2 {
           padding: 10px 20px;
            margin-bottom: 20px;
        }
        #box {
            float: right;

        }
    </style>
    
</head>
<body>
<h2>
    <div id="box">
        欢迎 ${user.username}&nbsp;&nbsp;&nbsp;&nbsp;
        <a href="logout">注销</a>
    </div>
</h2>
<ul>
    <li><button id="addUser" class="layui-btn layui-btn-normal layui-btn-sm">新增</button></li>
</ul>
<table class="layui-table" lay-skin="line" id="userlist"></table>

<script src="${ctx}/statics/layui/layui.all.js"></script>
<script>
    var table = layui.table;
    var $ = layui.jquery;
    table.render({
        elem:'#userlist',
        url: 'list',
        cols:[[
            {field:'id', width:80, title: 'ID', sort: true},
            {field:'username', width:180, title: '用户名', sort: true},
            {field:'password', width:180, title: '密码', sort: true},
            {field:'address', title: '地址', sort: true}
        ]],
        page:true
    });
    
    $("#addUser").click(function () {
        location.href = "toAdd"
    })
</script>
</body>
</html>
